#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <iostream>
#include <queue>
using namespace std;

#define TRACE(x...) 
#define PRINT(x...) TRACE(printf(x))
#define WATCH(x) TRACE(cout << #x << " = " << x << endl)

#define rep(i,n) for (int i=0; i<n; i++)

#define f first
#define s second
#define mp make_pair

#define ll long long
#define INF 0x3f3f3f3f
#define NINF 0xc0c0c0c0

#define sqr(x) ((x)*(x))

int n, m;
bool burn[2010][2010];
int k;
queue< pair<pair<int, int>, int> > q;
int x, y;
int lastX, lastY, lastT;
int t;
int d[4][2] = {{1,0},
		{0,1},
		{-1,0},
		{0,-1}};

void bfs() {
	rep(i,k) { 
		scanf("%d %d", &x, &y);
		x--; y--;
		q.push(mp(mp(x,y), 0));
	}

	TRACE(
		rep(i,n) {
			rep(j,m) printf("%d", burn[i][j]? 1:0);
			printf("\n"); 
		}
	)

	while (!q.empty()) {
		x=q.front().f.f;
		y=q.front().f.s;
		t=q.front().s;
		
		if (burn[x][y]) {
			q.pop(); continue;
		}
		
		burn[x][y]=true;
		q.pop();
		

		PRINT("Tree %d, %d burned on time %d\n", x, y, t); 

		if (lastT<=t) {
			lastX=x; lastY=y; lastT=t;
		}		

		rep(i,4) {
			int nx = x+d[i][0], ny=y+d[i][1];
			if (nx>=n || nx<0) continue;
			if (ny>=m || ny<0) continue;
			if (burn[nx][ny]) continue;

			q.push(mp(mp(nx,ny),t+1));
		}
	}
}

int main() {
	freopen("input.txt", "r", stdin);	
	freopen("output.txt", "w", stdout);

	scanf("%d %d", &n, &m);
	scanf("%d", &k);

	rep(i,n) rep(j,m) burn[i][j]=false;
	
	lastT=-1;
	bfs();

	printf("%d %d\n", lastX+1, lastY+1);
	
	return 0;
}
